<?php

class Talktangle_Plugin_Wellcome extends Zend_Controller_Plugin_Abstract {
	public function preDispatch(Zend_Controller_Request_Abstract $request) {
	   $controller = $request->getControllerName();
       $module = $request->getModuleName();

       $isAdminSite = !(strpos($controller, "admin-") != -1);      
       if($isAdminSite) return;
       
       $action = $request->getActionName();

       if($module == 'payment' || $controller == 'auth' || $controller == 'signup' || $controller == 'pages' || $controller == 'help' ) return;
       
       $viewer = Engine_Api::_()->user()->getViewer();
	   $user_id = $viewer->getIdentity();
       
	   if (!$viewer || empty($user_id)) {
			$request->setModuleName('core');
            $request->setControllerName('index');
            $request->setActionName('index');
	   }
        
   }
}